home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
btrieve
/
bconfi.arc
/
BCONFIG.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-05-11
|
13KB
|
430 lines
Program BConfig;
uses TPCRT,TPDOS,TPWindow;
Type
Str80 = String[80];
Const
Menu : Array[0..18] of String[23] =
('┌─────────────────────┐',
'│ BConfig 1.0 │',
'│BDEBUG config utility│',
'│ copyright (C) 1989 │',
'│ Jeff Bowles │',
'├─────────────────────┤',
'│ │',
'│ Window position │',
'│ Window size │',
'│ │',
'│ Clone BDEBUG │',
'│ Menu Color │',
'│ Selection Bar Color │',
'│ Window Color │',
'│ Exit this menu (ESC)│',
'├─────────────────────┤',
'│ Use to move bar. │',
'│ │',
'└─────────────────────┘');
Bwindow : Array[1..22] of string[80] =
('Operation -: ┌Key Value─┬─────────────────────────────┐',
' -: │..........│.............................│',
'Record Length-: BConfig 1.0 │..........│.............................│',
'Key No. -:BDEBUG config │..........│.............................│',
'Key Length -: (C) 1989 │..........│.............................│',
' -: Jeff Bowles │..........│.............................│',
'Status -: │..........│.............................│',
' -: │..........│.............................│',
' Hit Any Key To Continue └──────────┴─────────────────────────────┘',
'┌Record Buffer Value┬────────────────────────────────────────────────────────┐',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'│...................│........................................................│',
'└───────────────────┴────────────────────────────────────────────────────────┘');
Sel : integer = 0;
var
Wake,Double,WasIn8x8 : Boolean;
WPosX,WPosY,WHeight,WWidth : Byte;
BufPtr : WindowPtr;
Scr : Pointer;
Ch,XY,ScanLines : word;
FullName : string;
MenuColor, HiColor, WindowColor : Byte;
Procedure ShowToggles;
Begin
if Wake then
FastWrite(' Wake up ',9,28,MenuColor)
else
FastWrite(' Sleep ',9,28,MenuColor);
if Double then
FastWrite(' Double Strike ',12,28,MenuColor)
else
FastWrite(' Single Strike ',12,28,MenuColor);
End;
Procedure MenuBar (Hilite : boolean);
Begin
Case sel of
5,6,7 :
FastWrite(' F5 ForeGr F6 BackGr.',20,28,HiColor);
else
FastWrite(' Hit enter to select.',20,28,HiColor);
end;
if Hilite = True then
ChangeAttribute(21,9+sel,28,HiColor)
else
ChangeAttribute(21,9+sel,28,MenuColor);
End;
Procedure ShowWindow;
var X:integer;
Begin
if not DisplayWindow(BufPtr) then {};
HiddenCursor;
For x := 1 to Wheight-2 do
FastWriteClip(bwindow[x],x,1,WindowColor);
End;
Procedure ShowMenu(ReadKbd : boolean); forward;
Procedure WindowSize;
var ch : word;
Begin
Ch := 0;
if not (EraseTopWindow = nil) then {};
RestoreWindow(1,1,ScreenWidth,ScreenHeight,False,Scr);
ShowWindow;
Repeat
Ch := ReadKeyWord;
case Ch of
$4b00 : {left}
if WWidth > $1f then
if ResizeWindow(-1,0,' ') then dec(WWidth);
$4d00 : {right}
If ResizeWindow(1,0,' ') then inc(WWidth);
$4800 : {up}
if WHeight > $0b then
If ResizeWindow(0,-1,' ') then dec(WHeight);
$5000 : {down}
if WHeight < 24 then
If ResizeWindow(0,1,' ') then Inc(WHeight);
End;
ShowWindow;
until (ch = $011b) or (ch = $1c0d) ; {esc or enter}
if (EraseTopWindow=nil) then {};
RestoreWindow(1,1,ScreenWidth,ScreenHeight,False,Scr);
ShowMenu(True);
ShowToggles;
End;
Procedure WindowPos;
var ch : word;
Begin
Ch := 0;
if not (EraseTopWindow = nil) then {};
RestoreWindow(1,1,ScreenWidth,ScreenHeight,False,Scr);
ShowWindow;
Repeat
Ch := ReadKeyWord;
case Ch of
$4b00 : {left}
if MoveWindow(-1,0) then dec(WPosX);
$4d00 : {right}
If MoveWindow(1,0) then inc(WPosX);
$4800 : {up}
If MoveWindow(0,-1) then dec(WPosY);
$5000 : {down}
If WPosY < 23 then
If MoveWindow(0,1) then inc(WPosY);
End;
ShowWindow;
until (ch = $011b) or (ch = $1c0d) ; {esc or enter}
if (EraseTopWindow=nil) then {};
RestoreWindow(1,1,ScreenWidth,ScreenHeight,False,Scr);
ShowMenu(True);
ShowToggles;
End;
Procedure SoundBlip(HZ : Integer);
Begin
sound(HZ);
delay(50);
nosound;
End;
Procedure HeyYou;
Begin
FastWrite(' F5 ForeGr F6 BackGr.',20,28,(HiColor or $80));
SoundBlip(500);
Delay(1500);
FastWrite(' F5 ForeGr F6 BackGr.',20,28,HiColor);
{};
End;
Procedure Clone;
const
Fname : string = 'BDEBUG.COM';
var
CloneFile : File of Byte;
temp : byte;
Begin
FastWrite(' *** Now Cloning *** ',13,28,MenuColor);
MenuBar (True);
SoundBlip(2000);
Assign(CloneFile,fullname);
Reset(CloneFile);
Seek(CloneFile,$127f);
Write(CloneFile,WPosY);
Write(CloneFile,WPosX);
Write(CloneFile,WHeight);
Write(CloneFile,WWidth);
Temp := ord(Double);
Write(CloneFile,Temp);
Seek(CloneFile,$26d5);
Temp := ord(Wake);
Write(cloneFile,Temp);
Seek(clonefile,$3ea2);
Temp := $fd;
Write(clonefile,Temp);
Seek(CloneFile,$3A18);
Write(CloneFile,WindowColor);
Seek(CloneFile,$3CFB);
Write(CloneFile,MenuColor);
Seek(CloneFile,$3D2E);
Write(CloneFile,HiColor);
Close(CloneFile);
SoundBlip(2000);
FastWrite(' Clone BDEBUG ',13,28,MenuColor);
MenuBar (True);
End;
Procedure Select;
Begin
Case Sel of
0 : {wake/sleep}
Begin
Wake := Not(Wake);
ShowToggles;
MenuBar (True);
End;
1 : {window pos}
WindowPos;
2 : {window size}
WindowSize;
3 : {single/double}
Begin
Double := Not(Double);
Showtoggles;
MenuBar (True);
End;
4 : {clone}
Clone;
5 : HeyYou; {use F7-F8 instead}
6 : HeyYou; {use F7-F8 instead}
7 : HeyYou; {use F7-F8 instead}
8 : Ch := $011b; {quit}
End;
End;
Procedure SetFG( Var Kolor : Byte);
var f : byte;
begin;
f := (Kolor and $0F);
inc(f);
if f > 15 then f:=0;
Kolor := ((Kolor and $F0) or f);
ShowMenu(False);
end;
Procedure SetBG( Var Kolor : Byte);
var B : byte;
begin
B := Kolor SHR 4;
inc(B);
if B > 7 then b := 0;
Kolor := ((Kolor and $0F) or (B SHL 4));
ShowMenu(False);
End;
Procedure ShowMenu(ReadKbd : Boolean);
var x, terminal : byte;
Begin
HiddenCursor;
if ReadKbd then Terminal := 18 else Terminal := 5;
for x:=0 to Terminal do
begin
FastWrite(Menu[x],3+x,27,MenuColor);
If (x>0) and (x<5) then
ChangeAttribute(21,3+x,28,WindowColor);
end;
showtoggles;
MenuBar (True);
If Not ReadKbd then Exit;
Ch := 0;
Repeat
Ch := ReadKeyWord;
case Ch of
$1c0d : {enter}
Select;
$4800 : {up}
Begin
MenuBar (False);
dec(sel);
if sel<0 then sel := 8;
MenuBar (True);
End;
$5000 : {down}
Begin
MenuBar (False);
inc(sel);
if sel>8 then sel := 0;
MenuBar (True);
End;
$3f00 : {F5 set foreground color}
begin
Case Sel of
5: Begin
SetFG(MenuColor);
ShowMenu(True);
end;
6: Begin
SetFG(HiColor);
MenuBar(True);
With WindowP(BufPtr)^ do
begin
Draw.HAttr := HiColor;
DisplayedOnce := False;
end;
end;
7: Begin
SetFG(WindowColor);
ShowMenu(False);
With WindowP(BufPtr)^ do
begin
Draw.FAttr := WindowColor;
Draw.WAttr :=WindowColor;
DisplayedOnce := False;
end;
End;
else
SoundBlip(500);
end;
end;
$4000 : {F6 set background color}
begin
Case Sel of
5: Begin
SetBG(MenuColor);
ShowMenu(True);
End;
6: Begin
SetBG(HiColor);
MenuBar(True);
With WindowP(BufPtr)^ do
begin
Draw.HAttr := HiColor;
DisplayedOnce := False;
end;
End;
7: Begin
SetBG(WindowColor);
ShowMenu(False);
With WindowP(BufPtr)^ do
begin
Draw.FAttr := WindowColor;
Draw.WAttr := WindowColor;
DisplayedOnce := False;
end;
End;
else
SoundBlip(500);
end;
end;
End;
until ch = $011b; {esc}
NormalCursor;
End;
Procedure ReadCloneFile;
const
Fname : string = 'BDEBUG.COM';
var
CloneFile : File of Byte;
temp : byte;
Begin
if Not ExistOnPath(Fname,fullname) then
Begin
Writeln('Cannot find BDEBUG.COM on search path.');
Halt(1);
End;
GetCursorState(XY,ScanLines);
Explode := true;
ExplodeDelay := 5;
SoundFlagW := true;
SetFrameChars(#186,#205,#188,#187,#200,#201);
Assign(CloneFile,fullname);
Reset(CloneFile);
Seek(CloneFile,$127f);
Read(CloneFile,WPosY);
Read(CloneFile,WPosX);
Read(CloneFile,WHeight);
Read(CloneFile,WWidth);
Read(CloneFile,Temp);
Double := (Temp = 1);
Seek(CloneFile,$26d5);
Read(CloneFile,Temp);
Wake := (Temp = 1);
Seek(CloneFile,$3A18);
Read(CloneFile,WindowColor);
Seek(CloneFile,$3CFB);
Read(CloneFile,MenuColor);
Seek(CloneFile,$3D2E);
Read(CloneFile,HiColor);
Close(CloneFile);
End;
Begin {main}
ReadCloneFile;
if SaveWindow(1,1,ScreenWidth,ScreenHeight,True,Scr) then
begin
If Font8x8Selected then
begin
SelectFont8x8(False);
WasIn8x8 := True;
end
else
WasIn8x8 := False;
If MakeWindow(BufPtr,WPosX+1,WPosY+1,WPosX+WWidth,
WPosY+WHeight,True,True,True,WindowColor,
WindowColor,HiColor,' Sample Window ') then ShowMenu(True);
RestoreWindow(1,1,ScreenWidth,ScreenHeight,True,Scr);
RestoreCursorState(XY,ScanLines);
If WasIn8x8 then SelectFont8x8(True);
end;
End. {main}